package com.asen.commons.core.meta.dao;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 查询项集合
 *
 * @author ls
 * @version 1.0
 * @date 2024-04-09
 */
public class SelectCollection implements Serializable {

    /**
     * 查询选择项
     */
    private List<String> selectList = new ArrayList<String>();

    /**
     * 查询排除选择列
     */
    private List<String> excludeList = new ArrayList<String>();

    /**
     * 自定义查询项
     */
    private List<String> customList = new ArrayList<String>();

    public void addSelect(String fieldName) {
        if (selectList.contains(fieldName)) {
            return;
        }
        selectList.add(fieldName);
    }

    public void removeSelect(String fieldName) {
        if (selectList.contains(fieldName)) {
            selectList.remove(fieldName);
        }
    }

    public List<String> getSelectList() {
        return selectList;
    }

    public void addExclude(String fieldName) {
        if (excludeList.contains(fieldName)) {
            return;
        }
        excludeList.add(fieldName);
    }

    public void removeExclude(String fieldName) {
        if (excludeList.contains(fieldName)) {
            excludeList.remove(fieldName);
        }
    }

    public List<String> getExcludeList() {
        return excludeList;
    }

    public void addCustom(String custom) {
        if (customList.contains(custom)) {
            return;
        }
        customList.add(custom);
    }

    public void removeCustom(String custom) {
        if (customList.contains(custom)) {
            customList.remove(custom);
        }
    }

    public List<String> getCustomList() {
        return customList;
    }

    public boolean isEmpty() {
        return selectList.isEmpty() && excludeList.isEmpty() && customList.isEmpty();
    }

    public boolean isNotEmpty() {
        return !isEmpty();
    }

    public void clear() {
        selectList.clear();
        excludeList.clear();
        customList.clear();
    }
}
